﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Functions/DocumentManagement/Document.master" AutoEventWireup="true" CodeBehind="Main.aspx.cs" Inherits="HRDexCapstoneProject.DocumentManagement.WebForm1" %>

<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainPage" runat="server">
    
    
    <table style="width:100%;">
        <tr>
            <td>
                Files
                <asp:TextBox ID="txtnfName" runat="server"></asp:TextBox>
                <asp:Button ID="btnSearch" runat="server" Text="Search" 
                    onclick="btnSearch_Click" />
                <asp:GridView ID="gvFiles" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="FileID" DataSourceID="dsFiles" 
                    onselectedindexchanged="gvFiles_SelectedIndexChanged" 
                    onrowdeleted="gvFiles_RowDeleted">
                    <Columns>
                        <asp:BoundField DataField="FileID" HeaderText="FileID" InsertVisible="False" 
                            ReadOnly="True" SortExpression="FileID" Visible="False" />
                        <asp:BoundField DataField="FileName" HeaderText="FileName" 
                            SortExpression="FileName" />
                        <asp:BoundField DataField="FileType" HeaderText="FileType" 
                            SortExpression="FileType" />
                        <asp:BoundField DataField="FolderName" HeaderText="FolderName" 
                            SortExpression="FolderName" />
                        <asp:BoundField DataField="fulname" HeaderText="fulname" 
                            SortExpression="fulname" ReadOnly="True" />
                        <asp:ButtonField ButtonType="Button" CommandName="Select" HeaderText="Download" 
                            ShowHeader="True" Text="Download" />
                        <asp:ButtonField ButtonType="Button" CommandName="Delete" HeaderText="Delete" 
                            ShowHeader="True" Text="Delete" Visible="False"></asp:ButtonField>
                    </Columns>
                </asp:GridView>
                <asp:SqlDataSource ID="dsFiles" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:HRmainConnectionString %>" 
                    
                    
                    
                    SelectCommand="SELECT formFile.FileID, formFile.FileName, formFile.FileType, formFolder.FolderName, formEmployees.LastName + ', ' + formEmployees.FirstName AS fulname FROM formFile INNER JOIN formFolder ON formFile.FolderID = formFolder.FolderID INNER JOIN formEmployees ON formFile.EmployeesID = formEmployees.EmployeeID WHERE (formFolder.ParentFodler = @parentFolder)">
                    <SelectParameters>
                        <asp:SessionParameter Name="parentFolder" SessionField="pFolder" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td>
                <asp:FileUpload ID="upldrFiles" runat="server" />
                <asp:Button ID="btnUpload" runat="server" Text="Upload" 
                    onclick="btnUpload_Click" style="height: 26px" />
                <br />
                <asp:Label ID="lblStatus" runat="server"></asp:Label>
                <br />
                </td>
        </tr>
    </table>
    
    
    </asp:Content>
